Skip to content

disk: implement IOCountersWithContext for AIX nocgo via iostat#2033

Merged
shirou merged 2 commits intoshirou:masterfrom
Dylan-M:dylanmyers/disk-3b-iocounters
Mar 29, 2026
Merged

disk: implement IOCountersWithContext for AIX nocgo via iostat#2033
shirou merged 2 commits intoshirou:masterfrom
Dylan-M:dylanmyers/disk-3b-iocounters

Conversation

@Dylan-M
Copy link
Copy Markdown
Contributor

@Dylan-M Dylan-M commented Mar 21, 2026

Summary

Replaces the ErrNotImplementedError stub for IOCountersWithContext on the AIX nocgo path with a real implementation that parses iostat -d output.

Returns ReadBytes and WriteBytes for each disk by parsing the KB read/written columns and converting to bytes.

The CGO path already has a perfstat-based implementation (merged via #2016). This provides the nocgo fallback for environments where CGO is not available.

Only affects AIX nocgo path — no cross-platform changes.

@Dylan-M Dylan-M force-pushed the dylanmyers/disk-3b-iocounters branch 2 times, most recently from bd01d1b to 749ce99 Compare March 21, 2026 18:24
@shirou shirou requested a review from Copilot March 23, 2026 04:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements an AIX !cgo (nocgo) fallback for disk I/O counters by parsing iostat -d, replacing the previous ErrNotImplementedError stub, and refactors UsageWithContext parsing to match mountpoints more reliably while avoiding repeated mount subprocess calls.

Changes:

  • Implement IOCountersWithContext for AIX nocgo by parsing iostat -d and returning per-disk ReadBytes/WriteBytes.
  • Add a helper to build a device→fstype map from mount output and use it in UsageWithContext.
  • Fix UsageWithContext parsing to match the Path/mountpoint column and handle - values more robustly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread disk/disk_aix_nocgo.go Outdated
Comment thread disk/disk_aix_nocgo.go Outdated
@Dylan-M Dylan-M force-pushed the dylanmyers/disk-3b-iocounters branch from 749ce99 to efa2e76 Compare March 23, 2026 15:58
@Dylan-M Dylan-M force-pushed the dylanmyers/disk-3b-iocounters branch from efa2e76 to be66821 Compare March 27, 2026 16:26
Copy link
Copy Markdown
Owner

@shirou shirou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UsageWithContext changes (416f4ed) are already merged via #2032, so the effective diff here is only be66821 (IOCountersWithContext implementation). Reviewed that commit — looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants